import { MyGameObject } from "./MyGameObject";

export class Food extends MyGameObject{//food的生成放在gamemap的start
    constructor(r,c,gamemap)
    {
        super();
        
        this.r = r;
        this.c = c;
        this.gamemap = gamemap;
    }

    start(){

    }

    update(){
        this.render();
    }

    render(){

        const L = this.gamemap.L;
        const ctx = this.gamemap.ctx;
        
        let img = new Image(L,L);
        img.src = 'https://cdn.acwing.com/media/article/image/2023/05/25/134627_bdad1f75fb-food.png'
        ctx.drawImage(img, this.c * L, this.r * L,L,L);
    }


}